import request from '@/utils/request'
import type { ICategoryResponseData } from './type'

enum API {
  //一级分类接口地址
  C1_URL = '/admin/product/getCategory1',
  //二级分类接口地址
  C2_URL = '/admin/product/getCategory2/',
  //三级分类接口地址
  C3_URL = '/admin/product/getCategory3/',
}

//获取一级分类的接口方法
export const reqCategory1 = () => request.get<any, ICategoryResponseData>(API.C1_URL)

//获取二级分类的接口方法
export const reqCategory2 = (category1Id: number | string) =>
  request.get<any, ICategoryResponseData>(API.C2_URL + category1Id)

//获取三级分类的接口方法
export const reqCategory3 = (category2Id: number | string) =>
  request.get<any, ICategoryResponseData>(API.C3_URL + category2Id)
